package io.ebean.mocker.delegate;

import io.ebean.*;

import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;

/**
 * Provides an adaption layer for find methods.
 */
public interface InterceptFind {
//  <T> Query<T> find(Class<T> beanType, Transaction transaction);
//  <T> Query<T> findNative(Class<T> beanType, String nativeSql, Transaction transaction);
//  <T> T find(Class<T> beanType, Object id, Transaction transaction);

  void refresh(Object bean);

  void refreshMany(Object bean, String propertyName);

  <T> T findOne(Query<T> query, Transaction transaction);

  <T> T find(Class<T> beanType, Object id, Transaction transaction);

  <T> int findCount(Query<T> query);

  <A> List<A> findIds(Query<?> query);

  <T> void findEach(Query<T> query, Consumer<T> consumer);

  <T> void findEach(Query<T> query, int i, Consumer<List<T>> consumer);

  <T> void findEachWhile(Query<T> query, Predicate<T> consumer);

  <T> List<T> findList(Query<T> query);

  <T> FutureRowCount<T> findFutureCount(Query<T> query, Transaction transaction);

  <T> FutureIds<T> findFutureIds(Query<T> query, Transaction transaction);

  <T> FutureList<T> findFutureList(Query<T> query, Transaction transaction);

  <T> PagedList<T> findPagedList(Query<T> query, Transaction transaction);

  <T> Set<T> findSet(Query<T> query, Transaction transaction);

  <K, T> Map<K, T> findMap(Query<T> query, Transaction transaction);

  <T> List<Version<T>> findVersions(Query<T> query);

  <A> List<A> findSingleAttributeList(Query<?> query, Transaction transaction);

  <T> QueryIterator<T> findIterate(Query<T> query);

  <T> Stream<T> findStream(Query<T> query);

  boolean exists(Query<?> query, Transaction transaction);
}
